﻿using System;
using System.Collections.Generic;
using System.Text;
using Cosmos.Compiler.Builder;
using Cosmos.Sys;

namespace Hueton_1._2_Ultimate
{
    public class MenuOutput
    {
        #region strings
        public static string Wool;
        public static string PowerLine;
        #endregion

        #region menu1
        public static void Char()
        {
            var consola = Console.ReadLine();
            consola.ToLower();
            if (consola == "c")
            {
                Console.Clear();
                smartstart();
            }
            else
            {
                if (consola == "a")
                {
                    Calculator.Execute();
                    Console.Clear();
                }
                if (consola == "r")
                {
                    Console.Clear();
                    ExternalRunner.Main.Run();
                }
                if (consola == "p")
                {
                    PowerOptions();
                    Console.Clear();
                }
                Char();
            }
        }
        public static void smartstart()
        {
            Console.WriteLine("What can I help you with?");
            Console.WriteLine("Type '?' for help");
            Returning();
        }
        #endregion
        public static void Returning()
        {

            var lol = Console.ReadLine();
            Wool = lol;
            Wool.ToLower();
            if (Wool == "hi")
            {
                Console.WriteLine("Hi!");
                Returning();
            }
            else
            {
                if (Wool == "home")
                {
                    Console.Clear();
                    Program.Init();
                }
                if (Wool == "?")
                {
                    Console.Clear();
                    Console.WriteLine("[Write the command exactly as it says.]");
                    Console.WriteLine("Command = Action");
                    Console.WriteLine("- Home = Goes back to main menu");
                    Console.WriteLine("- Greets = List of Greetings");
                    Console.WriteLine("- RnPg = Browse through Programs");
                    Console.WriteLine("- RnPr = Browse through Processes");
                    Console.WriteLine("- Matrix = Endless and annoying matrix");
                    Console.WriteLine("- CntrlPnl = Opens Control Panel");
                    Console.WriteLine("< (Press < to go back)");
                    Returning();
                }
                if (Wool == "<")
                {
                    Console.Clear();
                    Returning();
                }
                else
                {
                    Console.WriteLine("I didn't really get that.");
                    Returning();
                }
            }
        }
        public static void PowerOptions()
        {
            Console.WriteLine("Type the command exactly as it says.");
            Console.WriteLine("- S = Shut Down");
            Console.WriteLine("- R = Restart");
            Console.WriteLine("- < = Home");
            var chosen = Console.ReadLine();
            PowerLine = chosen;
            if (PowerLine == "<")
            {
                Program.Init();
            }
            else
            {
                if (PowerLine == "S")
                {
                    Cosmos.Sys.Deboot.ShutDown();
                }
                if (PowerLine == "R")
                {
                    Cosmos.Sys.Deboot.Reboot();
                }
                else
                {
                    PowerOptions();
                }
            }
        }
    }
}
